# 拷贝文件并改名.例如: 把 a.txt文件 拷贝到 a[备份].txt 文件中
# 备份 stu_name.txt

# todo 把stu_name.txt  截取和组拼操作后得到stu_name[备份].txt
path1 = "stu_name.txt"
listname = path1.split('.')
path2 = listname[0]+"[备份]."+listname[1]
print(path2)

with open(path1,'r',encoding='utf-8') as f1 ,open(path2,'w',encoding='utf-8') as f2:
    info = f1.read() # 一次读取全部数据
    f2.write(info)  # 一次写出

print('-------备份结束-----------')
